package com.wzy.level.comment.commentServiceImpl;

import com.wzy.Jdbc封装.pojo.News_comment;
import com.wzy.level.byPage.byPageDto.ByPage;
import com.wzy.level.comment.commentDao.commentDao;
import com.wzy.level.comment.commentDaoImpl.commentDaoImpl;
import com.wzy.level.comment.commentService.commentService;

import java.util.ArrayList;
import java.util.List;

public class commentServiceImpl implements commentService {
    private commentDao commentDao = new commentDaoImpl();

    @Override
    public List<News_comment> selectAll() {
        List<News_comment> news_comments = commentDao.selectAll();
        if (news_comments.size()>0){
            return news_comments;
        }else {
            return new ArrayList<News_comment>();
        }
    }

    @Override
    public News_comment selectById(int id) {
        return commentDao.selectById(id);
    }

    @Override
    public List<News_comment> selectByPage(ByPage byPage) {
        return commentDao.selectByPage(byPage);
    }

    @Override
    public int insert(News_comment comment) {
        return commentDao.insert(comment);
    }

    @Override
    public int update(News_comment comment) {
        return commentDao.update(comment);
    }

    @Override
    public int deleteById(News_comment comment) {
        return 0;
    }

    @Override
    public int deleteByName(News_comment comment) {
        return 0;
    }
}
